﻿using AutoMapper;
using J.Status.Application.Command.RoomNumCommand;
using J.StatusModel.Dto;
using MediatR;
using StatusDto;
using StatusService;

namespace J.Status.Application.Handler.RoomNumHandler
{
    public class RoomNumSelect2Handler : IRequestHandler<RoomNumSelect2Command, PageDto<RoomNumDto>>
    {
        private readonly IRoomNumManageService roomNumManageService;
        private readonly IMapper mapper;
        public RoomNumSelect2Handler(IRoomNumManageService roomNumManageService, IMapper mapper)
        {
            this.mapper = mapper;
            this.roomNumManageService = roomNumManageService;
        }

        public async Task<PageDto<RoomNumDto>> Handle(RoomNumSelect2Command request, CancellationToken cancellationToken)
        {
            RoomStatusDto model = mapper.Map<RoomStatusDto>(request);
            return await roomNumManageService.RoomStatusShow2(model);
        }
    }
}
